//
//  ZCOrderCheckAddressCell.m
//  ZCJZ
//
//  Created by sujeking on 2019/2/27.
//  Copyright © 2019年 jeking. All rights reserved.
//

#import "ZCOrderCheckAddressCell.h"
#import "TBCityIconFont.h"
#import "generalToolBox.h"
@interface ZCOrderCheckAddressCell()
@property (weak, nonatomic) IBOutlet UILabel *namephoneLabel;
@property (weak, nonatomic) IBOutlet UILabel *addressLabel;

@property (weak, nonatomic) IBOutlet UIButton *defaultBtn;

@property (weak, nonatomic) IBOutlet UIImageView *limv;
@property (weak, nonatomic) IBOutlet UIImageView *rimv;
@property (weak, nonatomic) IBOutlet UILabel *chooseAddressLab;
@property (weak, nonatomic) IBOutlet UIImageView *lineImgView;

@end


@implementation ZCOrderCheckAddressCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    [self setupSubViews];
}

- (void)setFrame:(CGRect)frame{
    frame.origin.x += 10;
    frame.origin.y += 10;
    frame.size.height -= 10;
    frame.size.width -= 20;
    [super setFrame:frame];
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

- (void)setupSubViews {
    self.rimv.image = [UIImage iconWithInfo:TBCityIconInfoMake(@"\U0000e64a", 25, [generalToolBox getColorWithHexadecimalColorStr:@"0x666666"])];
    self.limv.image = [UIImage iconWithInfo:TBCityIconInfoMake(@"\U0000e632", 40, [generalToolBox getColorWithHexadecimalColorStr:@"0x666666"])];
}

- (void)setAddressModel:(WZGAddressModel *)addressModel{
    _addressModel = addressModel;
    if (addressModel) {
        self.chooseAddressLab.hidden = YES;
        self.lineImgView.hidden = NO;
        self.namephoneLabel.hidden = NO;
        self.addressLabel.hidden = NO;
        
        self.namephoneLabel.text = [NSString stringWithFormat:@"%@    %@",addressModel.name,addressModel.phone];
        self.defaultBtn.hidden = !addressModel.is_default;
        self.addressLabel.text = addressModel.full_address;
    }else{
        self.chooseAddressLab.hidden = NO;
        self.lineImgView.hidden = YES;
        self.addressLabel.hidden = YES;
        self.namephoneLabel.hidden = YES;
        
        self.namephoneLabel.text = nil;
        self.defaultBtn.hidden = YES;
        self.addressLabel.text = nil;
    }
}

@end
